// 路由
// createRouter 创建vue-router 示例对象
// RouteRecordRaw 示例规范，路由规则
// createWebHashHistory 用户路由模式Hash
import { createRouter,type RouteRecordRaw,createWebHashHistory } from 'vue-router'
import { userStore} from '../store/user'

// 创建路由规则
const routes = [
    {
        path:'/home',
        name:"home",
        component:()=> import('../components/HelloWorld.vue')
    },
    {
        path:'/hw1',
        name: "hw1",
        component:()=>  import('../components/HelloWorld1.vue')
    },
    {
        path:'/hw2',
        name: "hw2",
        component:()=>  import('../components/HelloWorld2.vue')
    }
]
// 创建路由对象
const router = createRouter({
    history: createWebHashHistory(),
    routes
})

router.beforeEach((to,from,next)=>{
    //const store = userStore()
    //if(store.token){
        next()
    //}
})

export default router
